package net.youpoint.entity;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.jdo.annotations.Element;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;

@PersistenceCapable(detachable = "true")
public class QuestionEntity {

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key key;

	@Persistent
	private String text;

	@Persistent
	private Date createDate;

	@Persistent
	private Date deleteDate;

	@Persistent(mappedBy = "question", defaultFetchGroup = "true")
	@Element(dependent = "true")
	private List<OptionEntity> options = new ArrayList<OptionEntity>();

	@Persistent(mappedBy = "question", defaultFetchGroup = "true")
	private List<CommentEntity> comments = new ArrayList<CommentEntity>();

	public String getText() {
		return this.text;
	}

	public void setText(final String text) {
		this.text = text;
	}

	public List<OptionEntity> getOptions() {
		return this.options;
	}

	public void setOptions(final List<OptionEntity> options) {
		this.options = options;
	}

	public List<CommentEntity> getComments() {
		return this.comments;
	}

	public void setComments(final List<CommentEntity> comments) {
		this.comments = comments;
	}

	public Date getCreateDate() {
		return this.createDate;
	}

	public void setCreateDate(final Date date) {
		this.createDate = date;
	}

	public Key getKey() {
		return this.key;
	}

	public void setKey(final Key key) {
		this.key = key;
	}

	public Date getDeleteDate() {
		return this.deleteDate;
	}

	public void setDeleteDate(final Date deleteDate) {
		this.deleteDate = deleteDate;
	}
}
